package org.example.lds240515;

/**
 * @author: hero生仔
 */
public class Test {
    public static void main(String[] args) {
        String str = new Test().reverseStr("absnsjs");
        System.out.println(str);
    }
    public String reverseStr(String str) {
        StringBuilder sb = new StringBuilder(str);
        int i = 0, j = str.length() - 1;
        while (i < j) {
            char tmp = sb.charAt(i);
            sb.setCharAt(i, sb.charAt(j));
            sb.setCharAt(j, tmp);
            i++;
            j--;
        }

        return sb.toString();
    }
}
